Design Patterns in Modern C++20 by Dmitri Nesteruk

Design Patterns in Modern C++20 by Dmitri Nesteruk

Author:Dmitri Nesteruk
Language: eng
Format: epub
ISBN: 9781484272954
Publisher: Apress


Building a Trading Terminal

I’ve spent a lot of time working in areas of quant finance and algorithmic trading. As you can probably guess, what’s required of a good trading terminal is quick delivery of information into a trader’s brain: you want things to be rendered as fast as possible, without any lag.

Most of financial data (except for the charts) is actually rendered in plain text: white characters on a black screen. This is, in a way, similar to the way the terminal/console/command-line interface works in your own operating system.

The first part of a terminal window is the buffer. This is where the rendered characters are stored. A buffer is a rectangular area of memory, typically a 1D2 or 2D char or wchar_t array. A buffer can be much larger than the visible area of the terminal window, so it can store some historical output that you can scroll back to.

Typically, a buffer has a pointer (e.g., an integer) specifying the current input line. That way, a full buffer doesn’t reallocate all lines; it just overwrites the oldest one.

Then there’s the idea of a viewport. A viewport renders a part of the particular buffer. A buffer can be huge, so a viewport just takes a rectangular area out of that buffer and renders that. Naturally, the size of the viewport has to be less than or equal to the size of the buffer.

Finally, there’s the console (terminal window) itself. The console shows the viewport, allows scrolling up and down, and even accepts user input. The console is, in fact, a façade: a simplified representation of what is a rather complicated set-up behind the scenes.

Typically, most users interact with a single buffer and viewport. It is, however, possible to have a console window where you have, say, the area split vertically between two viewports, each having their corresponding buffers. This can be done using utilities such as the screen Linux command.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.